package com.example.mynews.application;

import com.billy.cc.core.component.CC;
import com.example.base.BaseApplication;
import com.example.base.loadsir.CustomCallback;
import com.example.base.loadsir.EmptyCallback;
import com.example.base.loadsir.ErrorCallback;
import com.example.base.loadsir.LoadingCallback;
import com.example.base.loadsir.TimeoutCallback;
import com.example.base.preference.PreferencesUtil;
import com.example.mynews.BuildConfig;
import com.example.network.ApiBase;
import com.example.network.INetworkRequestInfo;
import com.kingja.loadsir.core.LoadSir;

public class NewsApplication extends BaseApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        PreferencesUtil.init(this);
        ApiBase.setNetworkRequestInfo(new NetworkRequestInfo());
        setDebug(BuildConfig.DEBUG);
        //设置LoadSir
        LoadSir.beginBuilder()
                .addCallback(new ErrorCallback())
                .addCallback(new EmptyCallback())
                .addCallback(new LoadingCallback())
                .addCallback(new TimeoutCallback())
                .addCallback(new CustomCallback())
                .setDefaultCallback(LoadingCallback.class)
                .commit();

        //开启debug模式
        CC.enableDebug(BuildConfig.DEBUG);
        //开启CC调用日志跟踪
        CC.enableVerboseLog(BuildConfig.DEBUG);
        //开启跨app组件调用
        CC.enableRemoteCC(BuildConfig.DEBUG);
    }
}
